import request from '../config/request.js';
import host from '../config/host';

const loadDeviceSpotCheckRecord = function (params,callback) {
    request.postData(
      host.pcHostUrl+'/checkConfig/loadCheckRecords.json',
      params,callback
    )
  };

const getUser = function(callback){
    request.postData(
        host.pcHostUrl+'/user/getUserInfo.json',
        {},callback
    )
}

//运维管理可执行任务列表
const getToDoCheckList= function(data, callback){
  request.postData(
    host.hostUrl+'/checkTaskRecord/queryDeviceCheckTypeView',
    data,
    callback
  );
}


//运维管理设备巡检详情页
const getDivceCheckDetail= function(data, callback){
  request.postData(
    host.hostUrl+'/checkTaskRecord/deviceCheckTypeViewDetail',
    data,
    callback
  );
}

//运维管理设备巡检详情页
const getDivceCheckCountByDay= function(id, callback){
  request.getData(
    `${host.hostUrl}/checkTaskRecord/countByDay?departmentId=${id}`,
    callback
  );
}

//运维管理设备巡检详情页
const postDivceCheckSubmit= function(data, callback){
  request.postData(
    host.hostUrl+'/checkTaskRecord/submit',
    data,
    callback
  );
}


// Test
const testIII = function(callback) {
  request.getData(
   host.hostUrl+'/factory/productFillData/productFillDataConifg',
   callback
  )
}

// 点巡检图表数据
const checkTaskRecord = function(departmentId, callback) {
  request.getData(
   host.pcHostUrl+`/wx/checkTaskRecord/countByDepartment/${departmentId}`,
   callback
  )
}
// 获取逾期处理负责人列表
const getOverdueDisposePerson = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/checkTaskRecord/overdueDisposeUserList`,
   data,
   callback
  )
}

// 逾期处理
const postOverdueDispose = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/checkTaskRecord/overdueDispose`,
   data,
   callback
  )
}
// 批量处理
const postOverdueDisposeByDepartment = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/checkTaskRecord/overdueDisposeByDepartment`,
   data,
   callback
  )
}
// 停车列表
const getParkPlanDetailList = function(deviceId, callback) {
  request.getData(
   host.pcHostUrl+`/wx/parkPlan/detailList/${deviceId}`,
   callback
  )
}

// 停车处理
const postParkPlanSubmit = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/parkPlan/submit`,
   data,
   callback
 )
}
// 运维管理-查询列表
const getDepartmentViewList = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/checkTaskRecord/queryDepartmentViewList`,
   data,
   callback
 )
}
// 运维管理-查询列表
const getDepartmentDetailsList = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/checkTaskRecord/departmentDetailsViewList`,
   data,
   callback
 )
}

// 停车处理
const deleteParkPlanSubmit = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/parkPlan/delete`,
   data,
   callback
 )
}

// 停车处理
const putParkPlanSubmit = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/parkPlan/update`,
   data,
   callback
 )
}
// 出库台账详情
const getOutboundOrderDetails = function(id, callback) {
  request.getData(
   host.pcHostUrl+`/wx/outboundOrder/details/${id}`,
   callback
 )
}
// 出库台账列表
const getOutboundOrderDepartment = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/outboundOrder/getOutboundOrderDepartment`,
   data,
   callback
 )
}
// 出库台账列表
const getOutboundOrderDepartmentDetails = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/outboundOrder/getOutboundOrderDetails`,
   data,
   callback
 )
}
// 出库台账列表
const getOutboundOrderDevice = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/outboundOrder/getOutboundOrderDevice`,
   data,
   callback
 )
}
// 出库台账获取部门
const getOutboundOrderUserServiceArea = function(callback) {
  request.getData(
   host.pcHostUrl+`/wx/outboundOrder/getUserServiceArea`,
   callback
 )
}
// 出库台账获取设备
const getOutboundOrderDeviceByDepartment = function(departmentId, callback) {
  request.getData(
   host.pcHostUrl+`/wx/outboundOrder/getDeviceByDepartment/${departmentId}`,
   callback
 )
}
// 出库台账获取领用人
const getOutboundOrderUserByDepartment = function(departmentId, callback) {
  request.getData(
   host.pcHostUrl+`/wx/outboundOrder/getUserByDepartment/${departmentId}`,
   callback
 )
}
// 出库台账新增
const postOutboundOrderSaveOrUpdate = function(data, callback) {
  request.postData(
   host.pcHostUrl+`/wx/outboundOrder/saveOrUpdate`,
   data,
   callback
 )
}
// 出库台账修改日志
const getOutboundOperatorLog = function(id, callback) {
  request.getData(
   host.pcHostUrl+`/wx/outboundOrder/getOperatorLog/${id}`,
   callback
 )
}



export default {
  loadDeviceSpotCheckRecord,getUser,getToDoCheckList,getDivceCheckDetail,testIII,getDivceCheckCountByDay,postDivceCheckSubmit,
  checkTaskRecord,
  getOverdueDisposePerson,
  postOverdueDispose,
  postOverdueDisposeByDepartment,
  getParkPlanDetailList,
  postParkPlanSubmit,
  deleteParkPlanSubmit,
  putParkPlanSubmit,
  getDepartmentViewList,
  getDepartmentDetailsList,
  getOutboundOrderDetails,
  getOutboundOrderDepartment,
  getOutboundOrderDepartmentDetails,
  getOutboundOrderDevice,
  getOutboundOrderDeviceByDepartment,
  getOutboundOrderUserByDepartment,
  getOutboundOrderUserServiceArea,
  postOutboundOrderSaveOrUpdate,
  getOutboundOperatorLog,
}